// src/main/java/com/neuedu/his/common/bean/ApiResult.java
package com.neuedu.his.common.bean;

public class ApiResult {
    private int code;
    private String msg;
    private Object data;

    // 私有构造器
    private ApiResult() {}

    // 成功静态方法
    public static ApiResult success() {
        ApiResult result = new ApiResult();
        result.code = 200;
        result.msg = "操作成功";
        return result;
    }

    // 错误静态方法
    public static ApiResult error(String message) {
        ApiResult result = new ApiResult();
        result.code = 500;
        result.msg = message;
        return result;
    }

    // 数据封装方法
    public ApiResult data(String key, Object value) {
        this.data = java.util.Collections.singletonMap(key, value);
        return this;
    }
    // Getter方法
    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() {
        return data;
    }
}